/*
 * 用户列表
 */
define(function(require, exports, module) {
    require("common/umei.dev");
    umei.url = {
	loadList : "loadDownLoadInfoList.do"
    }

    initPage(1);

    // 初始化页面列表
    function initPage(pageNo) {
	umei.pageNo = pageNo;
	var data = umei.searchParam + "&pageNo=" + pageNo;
	umei.postRequest({
	    async : true, url : umei.url.loadList, data : data, fun : function(response) {
		fillPage(response);
	    }
	});
    }

    function fillPage(response) {
	var data = response.data;
	var simplePage = data.page;
	var list = data.list;
	$("#pager_content tr:gt(0)").remove();
	if (list.length > 0) {
	    for (var i = 0, _len = list.length, d; i < _len, d = list[i]; i++) {
		$('<tr><td>' + d.userId + '</td><td>' + d.userName + '</td><td>' + d.downloadCount + '</td></tr>').appendTo($("#pager_content"));
	    }
	} else {
	    $('<tr><td  class="nodata" colspan="100">没有数据</td></tr>').appendTo($("#pager_content"));
	}
	umei.pagination({
	    pagePanelId : "pager", pageObj : simplePage, fun : initPage
	});
    }
});
